      module mo_indprd
      use shr_kind_mod, only : r8 => shr_kind_r8
      private
      public :: indprd
      contains
      subroutine indprd( class, prod, nprod, y, extfrc, rxt, ncol )
      use chem_mods, only : gas_pcnst, extcnt, rxntot
      use ppgrid, only : pver
      implicit none
!--------------------------------------------------------------------
! ... dummy arguments
!--------------------------------------------------------------------
      integer, intent(in) :: class
      integer, intent(in) :: ncol
      integer, intent(in) :: nprod
      real(r8), intent(in) :: y(ncol,pver,gas_pcnst)
      real(r8), intent(in) :: rxt(ncol,pver,rxntot)
      real(r8), intent(in) :: extfrc(ncol,pver,extcnt)
      real(r8), intent(inout) :: prod(ncol,pver,nprod)
!--------------------------------------------------------------------
! ... "independent" production for Explicit species
!--------------------------------------------------------------------
      if( class == 1 ) then
         prod(:,:,1) =.080_r8*rxt(:,:,167)*y(:,:,62)*y(:,:,1)
         prod(:,:,2) =rxt(:,:,104)*y(:,:,7)*y(:,:,5)
         prod(:,:,3) = (rxt(:,:,15) +rxt(:,:,16) +rxt(:,:,126)*y(:,:,8) + &
                 rxt(:,:,127)*y(:,:,20) +rxt(:,:,128)*y(:,:,2) + &
                 rxt(:,:,275)*y(:,:,25) +rxt(:,:,298)*y(:,:,34))*y(:,:,16) &
                  + (.500_r8*rxt(:,:,143)*y(:,:,51) +.560_r8*rxt(:,:,167)*y(:,:,62) + &
                 .050_r8*rxt(:,:,189)*y(:,:,82) +.200_r8*rxt(:,:,195)*y(:,:,83) + &
                 .300_r8*rxt(:,:,213)*y(:,:,79))*y(:,:,1) &
                  + (.220_r8*rxt(:,:,196)*y(:,:,6) +.220_r8*rxt(:,:,198)*y(:,:,8) + &
                 .110_r8*rxt(:,:,200)*y(:,:,13) +.220_r8*rxt(:,:,201)*y(:,:,60)) &
                 *y(:,:,84) + (.500_r8*rxt(:,:,231)*y(:,:,6) + &
                 .500_r8*rxt(:,:,232)*y(:,:,8) +.200_r8*rxt(:,:,234)*y(:,:,13) + &
                 .500_r8*rxt(:,:,235)*y(:,:,60))*y(:,:,90) &
                  + (.350_r8*rxt(:,:,140)*y(:,:,131) +rxt(:,:,162)*y(:,:,101) + &
                 rxt(:,:,183)*y(:,:,89))*y(:,:,20) + (.670_r8*rxt(:,:,24) + &
                 .670_r8*rxt(:,:,25))*y(:,:,83) + (rxt(:,:,31) +rxt(:,:,184)*y(:,:,8)) &
                 *y(:,:,89) +rxt(:,:,36)*y(:,:,55) +rxt(:,:,19)*y(:,:,59) &
                  +.700_r8*rxt(:,:,26)*y(:,:,82) +.450_r8*rxt(:,:,38)*y(:,:,100) &
                  +2.000_r8*rxt(:,:,39)*y(:,:,101) +rxt(:,:,33)*y(:,:,106) &
                  + extfrc(:,:,3)
         prod(:,:,4) =rxt(:,:,16)*y(:,:,16) +rxt(:,:,87)*y(:,:,21)*y(:,:,19) &
                  +rxt(:,:,45)*y(:,:,49)
         prod(:,:,5) = 0._r8
         prod(:,:,6) = 0._r8
         prod(:,:,7) = 0._r8
         prod(:,:,8) = 0._r8
         prod(:,:,9) = 0._r8
         prod(:,:,10) = 0._r8
         prod(:,:,11) = 0._r8
         prod(:,:,12) = 0._r8
         prod(:,:,13) = 0._r8
         prod(:,:,14) = 0._r8
         prod(:,:,15) = (rxt(:,:,135)*y(:,:,132) +rxt(:,:,144)*y(:,:,54) + &
                 .500_r8*rxt(:,:,157)*y(:,:,61) +.800_r8*rxt(:,:,161)*y(:,:,55) + &
                 rxt(:,:,162)*y(:,:,101))*y(:,:,20) + (rxt(:,:,152)*y(:,:,6) + &
                 .900_r8*rxt(:,:,155)*y(:,:,13) +2.000_r8*rxt(:,:,156)*y(:,:,60) + &
                 2.000_r8*rxt(:,:,207)*y(:,:,86) +rxt(:,:,235)*y(:,:,90))*y(:,:,60) &
                  + (rxt(:,:,206)*y(:,:,13) +2.000_r8*rxt(:,:,208)*y(:,:,86)) &
                 *y(:,:,86) +rxt(:,:,21)*y(:,:,61) +.400_r8*rxt(:,:,22)*y(:,:,102)
         prod(:,:,16) = 0._r8
         prod(:,:,17) = 0._r8
         prod(:,:,18) = 0._r8
         prod(:,:,19) = 0._r8
!--------------------------------------------------------------------
! ... "independent" production for Implicit species
!--------------------------------------------------------------------
      else if( class == 4 ) then
         prod(:,:,105) = 0._r8
         prod(:,:,108) =.180_r8*rxt(:,:,18)*y(:,:,12) +rxt(:,:,70)*y(:,:,128) &
                  +2.000_r8*rxt(:,:,1)
         prod(:,:,76) =rxt(:,:,4)*y(:,:,4)
         prod(:,:,32) = 0._r8
         prod(:,:,106) = + extfrc(:,:,1)
         prod(:,:,110) = + extfrc(:,:,2)
         prod(:,:,112) =.660_r8*rxt(:,:,18)*y(:,:,12)
         prod(:,:,103) = 0._r8
         prod(:,:,81) = 0._r8
         prod(:,:,51) = 0._r8
         prod(:,:,37) = 0._r8
         prod(:,:,101) =rxt(:,:,17)*y(:,:,12) +rxt(:,:,60)*y(:,:,39) +rxt(:,:,67) &
                 *y(:,:,40)
         prod(:,:,52) = 0._r8
         prod(:,:,33) = 0._r8
         prod(:,:,21) = 0._r8
         prod(:,:,114) =.180_r8*rxt(:,:,18)*y(:,:,12)
         prod(:,:,84) =rxt(:,:,17)*y(:,:,12)
         prod(:,:,107) = 0._r8
         prod(:,:,70) = 0._r8
         prod(:,:,111) =.050_r8*rxt(:,:,18)*y(:,:,12)
         prod(:,:,113) =rxt(:,:,60)*y(:,:,39) +3.000_r8*rxt(:,:,63)*y(:,:,41) &
                  +2.000_r8*rxt(:,:,64)*y(:,:,42) +3.000_r8*rxt(:,:,65)*y(:,:,43) &
                  +rxt(:,:,66)*y(:,:,44) +4.000_r8*rxt(:,:,61)*y(:,:,45) &
                  +3.000_r8*rxt(:,:,62)*y(:,:,46) +rxt(:,:,69)*y(:,:,48)
         prod(:,:,29) = 0._r8
         prod(:,:,104) = 0._r8
         prod(:,:,27) = 0._r8
         prod(:,:,17) = 0._r8
         prod(:,:,102) = 0._r8
         prod(:,:,83) = 0._r8
         prod(:,:,85) = 0._r8
         prod(:,:,34) = 0._r8
         prod(:,:,93) =rxt(:,:,67)*y(:,:,40) +rxt(:,:,68)*y(:,:,47) +rxt(:,:,69) &
                 *y(:,:,48)
         prod(:,:,109) = 0._r8
         prod(:,:,61) = 0._r8
         prod(:,:,78) = 0._r8
         prod(:,:,64) = 0._r8
         prod(:,:,66) = 0._r8
         prod(:,:,36) = 0._r8
         prod(:,:,43) = 0._r8
         prod(:,:,30) = 0._r8
         prod(:,:,47) = 0._r8
         prod(:,:,68) = 0._r8
         prod(:,:,67) = 0._r8
         prod(:,:,22) = 0._r8
         prod(:,:,74) = 0._r8
         prod(:,:,38) = 0._r8
         prod(:,:,87) = 0._r8
         prod(:,:,100) = 0._r8
         prod(:,:,57) = 0._r8
         prod(:,:,86) = 0._r8
         prod(:,:,23) = 0._r8
         prod(:,:,80) = 0._r8
         prod(:,:,45) = 0._r8
         prod(:,:,77) = 0._r8
         prod(:,:,62) = 0._r8
         prod(:,:,75) = 0._r8
         prod(:,:,88) = 0._r8
         prod(:,:,46) = 0._r8
         prod(:,:,18) = 0._r8
         prod(:,:,39) = 0._r8
         prod(:,:,19) = 0._r8
         prod(:,:,73) = 0._r8
         prod(:,:,71) = 0._r8
         prod(:,:,53) = 0._r8
         prod(:,:,72) = 0._r8
         prod(:,:,40) = 0._r8
         prod(:,:,79) = 0._r8
         prod(:,:,98) = 0._r8
         prod(:,:,63) = 0._r8
         prod(:,:,96) = 0._r8
         prod(:,:,92) = 0._r8
         prod(:,:,97) = 0._r8
         prod(:,:,41) = 0._r8
         prod(:,:,99) = 0._r8
         prod(:,:,44) = 0._r8
         prod(:,:,91) = 0._r8
         prod(:,:,94) = 0._r8
         prod(:,:,95) = 0._r8
         prod(:,:,42) = 0._r8
         prod(:,:,69) = 0._r8
         prod(:,:,90) = 0._r8
         prod(:,:,54) = 0._r8
         prod(:,:,25) = 0._r8
         prod(:,:,26) = 0._r8
         prod(:,:,60) = 0._r8
         prod(:,:,48) = 0._r8
         prod(:,:,31) = 0._r8
         prod(:,:,58) = 0._r8
         prod(:,:,59) = 0._r8
         prod(:,:,55) = 0._r8
         prod(:,:,49) = 0._r8
         prod(:,:,65) = 0._r8
         prod(:,:,89) = 0._r8
         prod(:,:,82) = 0._r8
         prod(:,:,24) = + extfrc(:,:,4)
         prod(:,:,35) = 0._r8
         prod(:,:,1) = 0._r8
         prod(:,:,20) = 0._r8
         prod(:,:,2) = 0._r8
         prod(:,:,3) = 0._r8
         prod(:,:,4) = 0._r8
         prod(:,:,5) = + extfrc(:,:,5)
         prod(:,:,6) = 0._r8
         prod(:,:,7) = 0._r8
         prod(:,:,8) = 0._r8
         prod(:,:,28) = 0._r8
         prod(:,:,50) = 0._r8
         prod(:,:,56) = 0._r8
         prod(:,:,9) = 0._r8
         prod(:,:,10) = 0._r8
         prod(:,:,11) = 0._r8
         prod(:,:,12) = 0._r8
         prod(:,:,13) = 0._r8
         prod(:,:,14) = 0._r8
         prod(:,:,15) = 0._r8
         prod(:,:,16) = 0._r8
      end if
      end subroutine indprd
      end module mo_indprd
